<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>
    <button type="button" id="query">请求数据</button>
    <div id="content" style=" width: 300px;height: 500px"></div>
</body>
<script type="text/javascript">
    $("#query").click(function () {
        $.ajax(
            {
                url:"http://127.0.0.1:8080/ping",
                dataType: "json",
                type: "get",
                contentType:"application/json;charset=utf-8",
                success: function (result) {
                    console.log(result.message);
                    $("#content").text(result.message)
                },
                error: function (data) {
                    alert("请求出错")
                }
            }
        );
    });
</script>
</html>
